<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>过渡动画：transition</title>
    <script src="./js/vue.js"></script>
    <style>
        .content {
            width: 200px;
            height: 200px;
            background: skyblue;
        }

        .fade-enter-active, .fade-leave-active {
            transition: opacity .5s;
        }

        .fade-enter, .fade-leave-to  /* .fade-leave-active below version 2.1.8 */{
            opacity: 0;
        }

        .slide-enter-active, .slide-leave-active {
            transition: all .5s;
        }

        .slide-enter, .slide-leave-to  /* .fade-leave-active below version 2.1.8 */{
            transform: translateX(500px);
            opacity: 0;
        }
    </style>
</head>

<body>
    <div id="app">
        <!-- 
            属性name会跟框架追加的类名一致
         -->
        <transition name='slide'>
            <div class="content" v-if='isShow'>

            </div>
        </transition>
        <button @click='toggleEvent'>切换内容</button>
    </div>

    <script>
        let app = new Vue({
            el: "#app",
            data: {
                isShow: true
            },
            methods: {
                toggleEvent: function () {
                    this.isShow = !this.isShow;
                }
            }
        })
    </script>
</body>

</html>